package com.zycloud.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.fastjson.JSON;
import com.zycloud.facade.UserFacade;
import com.zycloud.facade.dto.UserDto;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProductController {

    @Reference
    private UserFacade usercade;

    @RequestMapping("/loaduser/{id}")
    public String loadUser(@PathVariable("id") int id) {
        UserDto userDto = usercade.loadUserByUserId(id);
        if (userDto != null) {
            System.out.println(JSON.toJSONString(userDto));
            return JSON.toJSONString(userDto);
        }
        return "查不到，你要找的人";
    }

}
